<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.Map"%>
<%@ page import="java.util.List"%>
<%@ page import="java.util.Iterator"%>
<%@ page import="jt.classic.system.group.IGroup"%>
<%@ page import="jt.classic.system.user.IUser"%>
<%@ page import="jt.classic.system.ISystem"%>
<%@ page import="org.limp.mine.Label"%>
<%@ page import="org.limp.mine.Controller"%>
<%@ page import="org.limp.mine.DateTrimmer"%>
<%
	String context = jt.classic.system.ISystem.getContextPath();
	Object[] result = (Object[]) request.getAttribute("result");
	Label label = (Label) result[1];
	Controller controller = (Controller) result[2];
	String pageNO = (String) result[3];
	List resultList = (List) result[0];

	IUser user = ISystem.getSessionUser(request);

	Map query = (Map) request.getAttribute("query");

	List list = (List) request.getAttribute("list");

	String qname = (String) query.get("qname");
	String qdate = (String) query.get("qdate");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>领导日程列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<jsp:include page="../head.jsp"></jsp:include>
<script language="javascript">
  var chk = false;
  function checkall(thizz){
    var chks = document.getElementsByTagName("input");
    for(var i=0;i<chks.length;i++){
      if(chks[i].type == "checkbox"){
        chks[i].checked = !chk;
      }
    }
    
    chk = !chk;
  }
  
  /*function handleDelete(){
    var rnt = false;
    var ids = "";
    var chks = document.getElementsByTagName("input");
    for(var i=0;i<chks.length;i++){
      if(chks[i].type == "checkbox" && chks[i].checked){
        rnt = true;
        ids += chks[i].value + ",";
      }
    }
    
    if(!rnt){
      alert("请选择要删除信息");
    }else if(confirm("删除信息")){
      createHidden("ids",ids.substring(0,ids.length - 1));
      document.form1.action = "<%=context%>/app/info.do?method=delete";
      document.form1.submit();
    }
  }*/
  
  function handleQuery(){
      document.form1.action = context + "/app/ldrc.do?method=list";
      document.form1.submit();
  }
  
  function handleReresh(){
      window.location.href = context + "/app/ldrc.do?method=list&pageNO=<%=pageNO%>";
  }
  
  function handleView(id){
      var url = context + "/app/ldrc.do?method=view&id=" + id; 
      top.xwin(this,url,true,"",200,300);
  }
  
  function handleInsert(){
      window.location.href =  context + "/app/ldrc.do?method=neu"; 
  }
  
  function handleEdit(id){
      window.location.href = context + "/app/ldrc.do?method=edit&id=" + id; 
  }
  
  function handleDelete(id){
      if(confirm("确定删除")){
         window.location.href = context + "/app/ldrc.do?method=delete&id=" + id;
      }
  }
  
  function handleSelect(s){
      var url = context + "/app/info.do?method=directorytree&select=true";
      dialog(url,true,"选择所属栏目",300,350);
  }
  
  function responseResult(ids,names,types){
      document.form1.qdirec.value = names;
      
      closeDialog();
  }
</script>
<body>
<form name="form1" method="post" action=""><input type="hidden"
	name="pageNO" value="<%=pageNO%>">
<div style="padding-left:5px;margin-top:15px;">
领导 <input type="text" name="qname"
			class="box3" value="<%=qname%>" style="width:100px;"> 登记日期 <input
			type="text" name="qdate" class="box3" value="<%=qdate%>" readonly
			style="width:100px;" onclick="javascript:HS_setDate(this);"> 
			<img src="/app/info/images/search.png" title="查询领导日程信息" style="cursor:hand;margin-bottom:-4px;" onclick="javascript:handleQuery();"/>查询
            <img src="/app/info/images/addinfo.png" title="新建领导日程信息" style="cursor:hand;margin-bottom:-4px;" onclick="javascript:handleInsert();"/>新建
</div>
	<table class="tbl" align="center" width="98%">
	<thead>
	<tr>
		<td class="td1"
			width="10" align="center">&nbsp;</td>
		<td class="td1"
			width="25%" align="center">&nbsp;与会领导</td>
		<td class="td1"
			width="17%" align="center">&nbsp;主办单位</td>
		<td class="td1"
			width="20%" align="center">&nbsp;登记时间</td>
		<td class="td1"
			width="10%" align="center">&nbsp;登记人</td>
		<td class="td1"
			width="10%" align="center">&nbsp;状态</td>
		<td class="td1"
			width="13%" align="center">&nbsp;</td>
	</tr>
	</thead>
	<%
			if (resultList != null && !resultList.isEmpty()) {
			for (int i = 0; i < resultList.size(); i++) {
				Map info = (Map) resultList.get(i);
				String number = (String) info.get("PAGINATION_NUMBER");
				String id = (String) info.get("ID");
				String chld = (String) info.get("CHLD");
				String zbdw = (String) info.get("ZBDW");
				String djdate = (String) info.get("DJDATE");
				String djrname = (String) info.get("DJRNAME");
				String status = (String) info.get("STATUS");
				String statusn = "";
				if (status.equals("0")) {
			statusn = "待审批";
				} else if (status.equals("1")) {
			statusn = "审批通过";
				} else if (status.equals("-1")) {
			statusn = "审批未通过";
				}
	%>
	<tr onMouseOver="javascript:this.bgColor='#ffff99'"
		onmouseout=" javascript:this.bgColor='#ffffff'" bgColor="#ffffff">
		<td align="center"><!--<input type="checkbox" name="chk" value="<%=id%>">--><%=number%>
		</td>
		<td align="center">&nbsp;<a
			href="javascript:void(0);" onclick="javascript:handleView('<%=id%>');"><%=chld%></a></td>
		<td align="center">&nbsp;<%=zbdw%></td>
		<td align="center">&nbsp;<%=DateTrimmer.getYMDHMS_LBL(djdate)%></td>
		<td align="center">&nbsp;<%=djrname%></td>
		<td align="center"><%=statusn%></td>
		<td align="center">&nbsp; <%
 if (ISystem.matchrole(user, "ldms") || !status.equals("1")) {
 %>
		<a href="javascript:void(0);" onclick="javascript:handleEdit('<%=id%>');">编辑</a> <a
			href="javascript:void(0);" onclick="javascript:handleDelete('<%=id%>');">删除</a>&nbsp;</td>
		<%
		}
		%>
	</tr>
	<%
		}
		}
	%>
</table>
<table width="98%" class="tab-noborder" align="center">
	<tr>
		<td><%=label.displayLabel()%></td>
		<td align="right"><%=label.startLabel()%> <%=label.previousLabel()%>
		<%=label.nextLabel()%> <%=label.endLabel()%> <%=controller.getController().toString()%>
		</td>
	</tr>
</table>
<%=controller.getControlScript(true)%></form>
</body>
</html>
